<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="admin/common/header::common-head">
    <!--<#include "../common/header.html">-->
</head>
<body>
<!--边栏-->
<!--<#include "../common/nav.html">-->
<div th:replace="admin/common/nav::common-nav" ></div>
<script src="https://cdn.bootcss.com/twitter-bootstrap/3.0.1/js/bootstrap.min.js"></script>

<div class="content-wrapper" style="width: auto">
    <div class="container">
        <div class="row clearfix">
            <div class="col-md-12 column">
                <form role="form" action="/fashionpress/product/update" enctype="multipart/form-data" method="post">
                    <div class="form-group" th:if="${formProduct!=null}">
                        <label for="productId">商品编号:</label><input type="text" name="productId" id="productId" size="50" placeholder="50字以内" th:value="${formProduct!=null?formProduct.productId:''}" readonly="readonly" style="border: 0">
                    </div>
                    <div class="form-group">
                        <label for="productName">商品名称</label><input type="text" class="form-control" id="productName" name="productName" th:value="${formProduct!=null?formProduct.productName:''}"/>
                    </div>
                    <div class="form-group">
                        <label for="productPrice">商品单价</label><input type="number" class="form-control" id="productPrice" name="productPrice" th:value="${formProduct!=null?formProduct.productPrice:''}"/>
                    </div>
                    <div class="form-group">
                        <label for="productInventory">库存</label><input type="number" class="form-control" id="productInventory" name="productInventory" th:value="${formProduct!=null?formProduct.productInventory:''}" />
                    </div>
                    <div class="form-group">
                        <label for="productDescribe">商品简介</label><textarea id="productDescribe" name="productDescribe" class="form-control" rows="5" cols="20" th:text="${formProduct!=null?formProduct.productDescribe:''}"></textarea>
                    </div >
                    <div class="form-group">
                        <label for="productStatus0">商品状态</label>
                        <label><input type="radio" name="productStatus" value="0" id="productStatus0" />上架</label>
                        <lable><input type="radio" name="productStatus" value="1" id="productStatus1" />下架</lable>
                    </div>
                    <div class="form-group" th:if="${formProduct==null}">
                        <label for="mainImg">商品主展示图片</label><input type="file" id="mainImg" name="file"/>
                    </div>
                    <div class="form-group" th:if="${formProduct==null}">
                        <label for="imgs">商品详情展示图片</label><input type="file" id="imgs"  name="files"/>
                    </div>
                    <div class="form-group">
                        <label for="productCategory">商品分类</label>
                        <select id="productCategory" name="categoryId" class="form-control" >
                            <option th:each="category:${categorys}" th:value="${category.categoryId}" th:text="${category.categoryName}"></option>
                        </select>
                    </div >
                    <div class="checkbox">
                    </div> <button type="submit" class="btn btn-default">提交</button>
                </form>
            </div>
        </div>
    </div>


    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
    <script>
        $(document).ready(function () {
            if ([[${formProduct.productStatus}]]!=null ){
                if ([[${formProduct.productStatus}]]==0){
                    $("#productStatus0").attr("checked","true");
                }
                else{
                    $("#productStatus1").attr("checked","true");
                }
            }
        });
    </script>

</div>
<div th:replace="admin/common/footer::common-footer"></div>
</body>
</html>